import 'package:flutter/material.dart';

class ToutiaoArticleDetail extends StatelessWidget {
  final String title;
  const ToutiaoArticleDetail(this.title, {Key? key}) : super(key: key);
  
  @override
  Widget build(BuildContext context) {
     return WillPopScope(
      child: Scaffold(
      appBar: AppBar(
        title: Text('文章详情')
      ),
      body: Center(
        child:Container(
          child: Text('${this.title}'),
        ),
      ),
      ),
      onWillPop: () async {
        Navigator.of(context).pop({'title' : this.title});
        return true;
      },
    );


  }

}

// class _ToutiaoArticleState extends State<ToutiaoArticleDetail>{

//   final String title;
//   const _ToutiaoArticleState(this.title, {Key? key}) : super(key: key);
//   @override
//   Widget build(BuildContext context) {
    
//     //  Map<String, dynamic> param = ModalRoute.of(context)!.settings.arguments as Map<String, dynamic>;

//     return WillPopScope(
//       child: Scaffold(
//       appBar: AppBar(
//         title: Text('文章详情')
//       ),
//       body: Center(
//         child:Container(
//           child: Text('${param['title']}'),
//         ),
//       ),
//       ),
//       onWillPop: () async {
//         Navigator.of(context).pop({'title' : param['title']});
//         return true;
//       },
//     );

//   }
  
// }